// pages/tabbar/tabbar.js
Component({

  properties: {
    tabbrvalue: Number
  },

  /**
   * 页面的初始数据
   */
  data: {
    list: [
      { value: 1, image: '/img/icon_fangyuan.png', imaged: '/img/tb/lb3.png', ariaLabel: '房源信息' },
      { value: 2, image: '/img/icon_fuwu.png', imaged: '/img/tb/lb1.png', ariaLabel: '服务保障' },
      { value: 3, image: '/img/icon_jiage.png', imaged: '/img/tb/lb2.png', ariaLabel: '历史价格' },
      { value: 4, image: '/img/icon_my.png', imaged: '/img/tb/lb3.png', ariaLabel: '个人中心' }
    ],
  },

  methods: {

    onChangeTabbar(e) {
      switch (e.detail.value) {
        case 1:
          if (this.properties.tabbrvalue !== e.detail.value) {
            wx.reLaunch({
              url: '/pages/index/index',
            })
          }
          break;
        case 2:
          if (this.properties.tabbrvalue !== e.detail.value) {
            wx.reLaunch({
              url: '/pages/seek/seek',
            })
          }
          break;
        case 3:
          if (this.properties.tabbrvalue !== e.detail.value) {
            wx.reLaunch({
              url: '/pages/mine/mine',
            })
          }
          break;
        default:
          break;
      }

      this.setData({
        value: e.detail.value,
      });

    },

  },

})